using System;
using System.Collections.Generic;
using System.Text;
using Jonathan.Tabber;

namespace Jonathan
{
	/// <summary>
	/// Control used to create and save notes inside of Jonathan.
	/// </summary>
    public class ctrlNote : TabberPage
    {
        private ctrlTextNote m_Note;

		/// <summary>
		/// Creates a new Note Control.
		/// </summary>
        public ctrlNote ()
        {
			this.m_Note = new ctrlTextNote();
            this.m_Note.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(this.m_Note);
			this.TabTitle = "New Note";
			this.Load += new EventHandler(ctrlNote_Load);
        }

		void ctrlNote_Load (object sender, EventArgs e)
		{
			this.m_Note.SetNoteTab(this);
		}

        /// <summary>
        /// Opens the given file...
        /// </summary>
        /// <param name="filePath">Path of File to Open.</param>
        public void OpenFile (string filePath)
        {
            this.m_Note.OpenFile(filePath);
        }

		/// <summary>
		/// Override to get the tab page's info on closing.
		/// </summary>
		/// <returns>String of Info to be saved.</returns>
        public override string GetPageInfo ()
        {
            if (string.IsNullOrEmpty(this.m_Note.File))
                return base.GetPageInfo();
            else
                return this.m_Note.File;
        }
    }
}
